<script setup>
import { ref } from "vue";
import { useAuthStore } from "@/store";
const authStore = useAuthStore();
const { authLogin } = authStore;
import { useRouter } from "vue-router";
const router = useRouter();
import { useI18n } from "vue-i18n";
const { t } = useI18n();

import LanguageSwitcher from "@/components/LanguageSwitcher.vue";

const handleLogin = async () => {
  console.log("登陆");
  const res = await authLogin();
  console.log(res);
  router.replace({
    path: "/",
  });
};

const handleLanguageChange = (lang) => {
  console.log("当前语言:", lang);
};
</script>

<template>
  <div class="h-full flex flex-col justify-center items-center">
    <div class="mb-[100px] text-[20px] font-bold">
      {{ t("test.loginPage") }}
    </div>
    <button
      @click="handleLogin"
      class="px-[20px] py-[10px] bg-[#333] text-white rounded-[5px]"
    >
      {{ t("test.login") }}
    </button>
    <div class="mt-[100px]">
      <LanguageSwitcher @change="handleLanguageChange" ref="langSwitcher" />
    </div>
  </div>
</template>

<style></style>
